﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace QuickFramework.SqlSugarOrm
{
    public partial interface IRepository<T> : Shared.Contracts.IDependency where T : Shared.Contracts.EntityBase, new()
    {
        /// <summary>
        /// 数据库链接名
        /// </summary>
        string ConnectionStringName { get; }
        /// <summary>
        /// 仓储内部使用的工作单元,使用当前数据库链接创建
        /// 每次获取都将获取到新的UnitOfWork,可以直接开启事务
        /// new UnitOfWork().CreateUoW(m_ConnectionStringName, m_IsMaster)
        /// </summary>
        IUnitOfWork CreateUnitOfWork();
        /// <summary>
        /// ADO 对象
        /// </summary>
        IAdo Ado(IUnitOfWork unitOfWork = null);
        /// <summary>
        /// SqlSugarClient 对象
        /// </summary>
        SqlSugarClient SqlSugarClient(IUnitOfWork unitOfWork = null);
        /// <summary>
        /// SqlSugarClient 对象
        /// </summary>
        SimpleClient<T> SimpleClient(IUnitOfWork unitOfWork = null);
        /// <summary>
        /// 只更新实体设定过值的栏位
        /// </summary>
        /// <param name="UpdateObj"></param>
        /// <param name="unitOfWork"></param>
        /// <returns></returns>
        IUpdateable<T> Updateable4Set(T UpdateObj, IUnitOfWork unitOfWork = null);
    }
}
